home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET 2
/
BCI NET 2.iso
/
archives
/
programming
/
amos
/
srmv23.lha
/
Resource_Banks
/
Bin
/
SRM_v23.AMOS
/
SRM_v23.amosSourceCode
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
AMOS Source Code
|
1992-09-03
|
35.6 KB
|
1,277 lines
' AMOSPro Resource Bank Maker V2.3
' Default bank number is 16. Change the "BK" variable for another bank
' Maximum bank size is in variable "BMAX"
'
' update By M&F
' (c) 1993 M&F Software Corp.
' � 1994 9 November h17.00
'
' original vesion by Fran�ois Lionet
' (c)1992 Europress Software Ltd.
'
' Due to a bug in the Screen width function the picture width must be
' multiple of 16. Otherwise the far right and bottom of the image
' cannot be used.
'
'
Set Buffer 32
VER$="2.3"
Global DB$,VER$
Global YDI,QUIT,SCRN,XS,YS,SA,MOVE
Global BNAME$
Global PUMX,NPU,CPU,PNAME$,PULAST,PUPICS
Global STMX,NST
Global MX,MY,MK,MZ,MS,SW1,SH1,SW2,SH2
Global BXOLD,BXINK,FL
Global BXX,BXY,BXSX,BXSY
Global BKPOS,BKCHANGE,BK,TBNK,BKCHUNKS,BGRB,BMAX
' Maximum number of graphic elements
PUMX=512
Dim PUX(PUMX),PUY(PUMX),PUSX(PUMX),PUSY(PUMX),PU$(PUMX),PUN(PUMX)
Global PUX(),PUY(),PUSX(),PUSY(),PU$(),PUN()
' Maximum number of strings
STMX=256
Dim ST$(STMX)
Global ST$()
' Default bank number
BK=16
' Maximum bank size (in K)
BMAX=128
' Temporary bank
TBNK=BK+2
C$=Command Line$
' Memory check
If Chip Free+Fast Free<(BMAX+32)*1024 : LOWMEM : End If
' Initialisation
Erase All
'Area slider
SA=20
INIT_SCREEN
BANK_NEW
If C$="GRAB" : MN_GRAB : End If
MN_MAIN[C$]
' Main Menu
Procedure MN_MAIN[C$]
Do
If BGRB
A$="-GRABBED- "
Else
A$=""
End If
If BNAME$=""
Vdialog$(1,0)=A$+"Unnamed"
Else
Vdialog$(1,0)=A$+Right$(BNAME$,24-Len(A$))
End If
D=Dialog Run(1,1)
If C$="DEFAULT_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Default_Resource"]
End If
If C$="EDITOR_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Editor_Resource"]
End If
If C$="MONITOR_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Monitor_Resource"]
End If
Repeat
Multi Wait
D=Dialog(1)
On D Proc MN_QUIT,MN_QUIT,MN_NEW,MN_LOAD,MN_SAVE,MN_SAVEAS,MN_GRAPHIC,MN_STRING,MN_GRAB,MN_ABOUT
OLDD=D
Until QUIT
QUIT=0
Loop
End Proc
Procedure MN_QUIT
' Quit the program
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Quit resource bank maker. Sure?")
End If
If D=2
If BGRB
D=Dialog Box(DB$,1,"Copy resource bank to previous program?")
If D=2
BNK_CREATE
If Param>=0
Bsend BK
Else
D=Dialog Box(DB$,2,"Out of memory, cannot grab bank!")
Pop Proc
End If
Else
D=Dialog Box(DB$,1,"Your bank will be lost if you quit. Quit anyway?")
If D<>2 : Pop Proc : End If
End If
End If
Dialog Close 1
Screen Close 0 : If PNAME$<>"" : Screen Close 1 : End If
Erase BK : Edit
End If
End Proc
Procedure MN_NEW
' Create a new bank
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Create a new bank, and loose current?")
End If
If D=2 : BANK_NEW : QUIT=-1 : End If
End Proc
Procedure MN_LOAD
Dialog Freeze
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Load a new bank, and loose current?")
End If
If D=2
BANK_NEW : QUIT=-1
F$=Fsel$("*.Abk","","Please choose resource bank.")
If F$="" : Pop Proc : End If
Trap Load F$,BK
If Errtrap=0
A$="" : If Length(BK) : A$=Peek$(Start(BK)-8,8) : End If
If A$<>"Resource"
D=Dialog Box(DB$,2,"This bank is not a resource bank.")
Else
BNK_DIGEST[Start(BK)]
If Param : BNAME$=F$ : End If
End If
Else
D=Dialog Box(DB$,2,"Disc error: could not load bank.")
End If
If BGRB : BKCHANGE=1 : End If
End If
Erase BK : Dialog Unfreeze : QUIT=-1
End Proc
Procedure BNK_DIGEST[AB]
Do
BKCHUNKS=Deek(AB) : DD=2 : If BKCHUNKS=0 : BKCHUNKS=2 : DD=0 : End If
' Grab the graphic data
AG=Leek(AB+DD)
If AG
AG=AB+AG : NP=Deek(AG) : AP=AG+2+NP*4
Add AP,4+32*2 : L=Deek(AP) : PNAME$=Peek$(AP+2,L)
P=0 : CPOS=0
Repeat
A=Leek(AG+P*4+2)
If A
AP=AG+A
PUX(CPOS)=Deek(AP+4)*8 : PUY(CPOS)=Deek(AP+6)
PUSX(CPOS)=Deek(AP+8)*8 : PUSY(CPOS)=Deek(AP+10)*Deek(AP+12)
PUN(CPOS)=1
If Deek(AP-2)=$ABCD
T=Peek(AP-3) : K=Peek(AP-4) : PUN(CPOS)=T
If T=3
If K=0 : PUSX(CPOS)=PUSX(CPOS)*3 : End If
If K=1 : PUSY(CPOS)=PUSY(CPOS)*3 : PUN(CPOS)=-PUN(CPOS) : End If
Add P,2
End If
If T=9 : PUSX(CPOS)=PUSX(CPOS)*3 : PUSY(CPOS)=PUSY(CPOS)*3 : Add P,8 : End If
End If
End If
Inc CPOS : Inc P
Until P>=NP
End If
' Grab the strings
A=Leek(AB+4+DD)
If A
AP=AB+A : ST=0
For ST=0 To STMX
L=Peek(AP+1) : Exit If L=$FF
ST$(ST)=Peek$(AP+2,L)
AP=AP+2+L
Next
End If
' Keep the other data zones in safe places
If BKCHUNKS>2
For B=2 To BKCHUNKS-1
A=Leek(AB+DD+B*4)
If A
AP=AB+A
L=Leek(AB+DD+BKCHUNKS*4+B*4)
Reserve As Work TBNK+B,L
Copy AP,AP+L To Start(TBNK+B)
End If
Next
End If
' Load the picture
If PNAME$<>""
Repeat
Trap Load Iff PNAME$,1
If Errtrap
PNAME$=Fsel$("*.Iff","","Can't load the default picture","Please enter correct pathname")
If PNAME$=""
BANK_NEW
D=Dialog Box(DB$,2,"Sorry, load aborted!")
Exit 2
End If
End If
Until Errtrap=0
SW1=Screen Width : SH1=Screen Height
'Testing resolution of the image
SC=Screen Mode
If SC=$0 : SH2=256 : SW2=320 : End If
If SC=$4 : SH2=512 : SW2=320 : End If
If SC=$8000 : SH2=256 : SW2=640 : End If
If SC=$8004 : SH2=512 : SW2=640 : End If
Screen To Back 1 : Screen 0 : SCRN=1 : XS=0 : YS=0
Screen Display 1,136,42,320,SH2
End If
F=-1 : Exit
Loop
End Proc[F]
Procedure MN_SAVE
Dialog Freeze
BNK_CREATE
If Param>0
If BNAME$=""
F$=Fsel$("*.Abk","","Please choose a name.","The name should finish by '.Abk'")
If F$="" : Goto _END : End If
BNAME$=F$
End If
If BNAME$<>""
Trap Save BNAME$,BK
If Errtrap=0
BKCHANGE=0
Else
D=Dialog Box(DB$,2,"Disc error: could not save bank.")
End If
End If
Else If Param=0
D=Dialog Box(DB$,2,"Nothing to save!")
Else
D=Dialog Box(DB$,2,"Out of memory!")
End If
_END: Erase BK : Dialog Unfreeze : QUIT=-1 : Pop Proc
End Proc
Procedure BNK_CREATE
LMAX=BMAX*1024+Length(TBNK)+Length(TBNK+1)
Reserve As Data BK,LMAX
' Header
Poke$ Start(BK)-8,"Resource"
AB=Start(BK) : EB=Start(BK)+LMAX
AL=AB+2+BKCHUNKS*4 : AP=AL+BKCHUNKS*4
Doke AB,BKCHUNKS
' Grab the graphic part
PU_ARRAY
If PULAST>=0
Screen Hide 0
AG=AP : Loke AB+2,AG-AB
Doke AG,PUPICS : AP=AG+2+PUPICS*4
Screen 1
Doke AP,Screen Colour : Doke AP+2,Deek(Screen Base+72) : Add AP,4
For C=0 To 31 : Doke AP,Colour(C) : Add AP,2 : Next
Doke AP,Len(PNAME$) : Poke$ AP+2,PNAME$
AP=AP+Len(PNAME$)+2 : AP=AP+AP mod 2
PN=0
For P=0 To PULAST
If PUN(P)
If PUN(P)>0 : Poke AP,0 : Poke AP+1,PUN(P) : End If
If PUN(P)<0 : Poke AP,1 : Poke AP+1,-PUN(P) : End If
Doke AP+2,$ABCD : Add AP,4
If PUN(P)=1
X=PUX(P) : Y=PUY(P) : SX=PUSX(P) : SY=PUSY(P) : Gosub BK_GRAB
Else If PUN(P)=3
SX=PUSX(P)/3 : Y=PUY(P) : SY=PUSY(P)
For XX=0 To 2 : X=PUX(P)+XX*SX : Gosub BK_GRAB : Next
Else If PUN(P)=-3
SY=PUSY(P)/3 : X=PUX(P) : SX=PUSX(P)
For YY=0 To 2 : Y=PUY(P)+YY*SY : Gosub BK_GRAB : Next
Else If PUN(P)=9
SX=PUSX(P)/3 : SY=PUSY(P)/3 : N=0
For YY=0 To 2 : For XX=0 To 2
X=PUX(P)+XX*SX : Y=PUY(P)+YY*SY : Gosub BK_GRAB
Next : Next
End If
End If
Next
Loke AL,AP-AG
Screen Show 0 : Screen 0
End If
' Grab the text part
For S=0 To STMX
If Len(ST$(S))
SM=S : Add LS,Len(ST$(S))
End If
Next
If LS
AG=AP : Loke AB+2+4,AP-AB
For S=0 To SM
Poke AP,0
Poke AP+1,Len(ST$(S))
Poke$ AP+2,ST$(S)
Add AP,2+Len(ST$(S))
Next
Poke AP,0 : Poke AP+1,$FF : Add AP,2
Add AP,AP mod 2
Loke AL+4,AP-AG
End If
' Restore the data zones
If BKCHUNKS>2
For B=2 To BKCHUNKS-1
If Length(TBNK+B)
Loke AB+2+B*4,AP-AB
Loke AL+B*4,Length(TBNK+B)
Copy Start(TBNK+B),Start(TBNK+B)+Length(TBNK+B) To AP
Add AP,Length(TBNK+B)
Add AP,AP mod 2
Else
Loke AB+2+B*4,0 : Loke AL+B*4,0
End If
Next
End If
' Schink to the correct size
L=AP-Start(BK) : Bank Shrink BK To L
Screen Show 0 : Screen 0
Pop Proc[L]
BK_GRAB:
_BOX[X,Y,X+SX,Y+SY] : Wait 2 : _BOX[0,0,0,0]
Loke AG+2+PN*4,AP-AG
Pack 1 To BK+1,X,Y,X+SX,Y+SY
If AP+Length(BK+1)>=EB : Stop : End If
Copy Start(BK+1),Start(BK+1)+Length(BK+1) To AP
AP=AP+Length(BK+1) : AP=(AP+1) and $FFFFFFFE
Erase BK+1
Inc PN : Return
End Proc[L]
Procedure MN_SAVEAS
N$=BNAME$ : BNAME$=""
MN_SAVE
If BNAME$="" : BNAME$=N$ : End If
QUIT=-1
End Proc
Procedure MN_GRAB
Dialog Freeze
If Prg Under
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Grab a new bank, and loose current?")
End If
If D=2
BANK_NEW : BGRB=-1
If Blength(BK)
If Peek$(Bstart(BK)-8,8)="Resource"
BNK_DIGEST[Bstart(BK)]
End If
End If
If BGRB=0 : D=Dialog Box(DB$,2,"No bank to grab!") : End If
End If
End If
Dialog Unfreeze : QUIT=-1
End Proc
Procedure MN_AUTOMATIC[F$]
Trap Load F$,BK
D=Dialog Box(DB$,1,"Update of "+F$+"?")
If D=2
If Errtrap=0
BNK_DIGEST[Start(BK)]
If Param
BNAME$=F$
BNK_CREATE
If Param>0
Save BNAME$,BK
Else If Param=0
D=Dialog Box(DB$,2,"Nothing to save!")
Else
D=Dialog Box(DB$,2,"Out of memory!")
End If
End If
Else
D=Dialog Box(DB$,2,"Cannot load resource bank!")
End If
End If
BANK_NEW : BGRB=0 : MN_QUIT
End Proc
Procedure MN_ABOUT
Screen Open 3,640,190,4,Hires
Paper 2 : Pen 3 : Set Tab 2 : Clw
Flash Off : Curs Off : Scroll Off
Dialog Freeze
TXT1:
Data " ","*** SUPER RESOURCE MAKER V.2.3 ***"
Data " By M&F Software Corporation �1993-1994"," "
Data "This increased version of the original program has new features"
Data "I) The new button [MOVE BLOCK] in the graphic editor allows you to move the"
Data "flashing box without having to redefine the block."
Data "It is now possible to modify the size [SIZE] and the position [TRANS] of the"
Data "flashing box without having to redefine the entire block."
Data "II) Now the program supports pictures that may be larger than the screen."
Data "In the graphic editor, if you move the pointer close to the borders, the"
Data "picture will scroll. The program will automatically recognize the size of"
Data "the picture (it may be as large as you want if you have enough chip memory)."
Data "III) The contol panel has been enlarged to make the selection of an"
Data "element easier. The scrolling of the list has been increased."
Data "The SLIDER is updated faster after any operation."
Data "IV) Automatically set the resolution of the screen to suit that of the picture."
Data "Now you can freerly use low and hires pictures but the width of the picture"
Data "must be a multiple of 16."
Data " "
Data "This version fixes some other bug of the original version."
Data "Press the right mouse button to exit",""
Home
Restore TXT1 :
D$="*"
While D$<>""
Read D$ : Centre D$ : Cdown
Wend
Repeat
Until Mouse Key=2
Screen Close 3
Dialog Unfreeze
End Proc
' String Edition
Procedure MN_STRING
POS=0
Do
Vdialog(1,3)=Array(ST$(0))
Vdialog(1,4)=POS
D=Dialog Run(1,2)
Do
Multi Wait
D=Dialog(1) : Exit If D=1,2
POS=Vdialog(1,4)
If D=6
MN_PRINT : Exit
End If
If D=5
A=Dialog Box(DB$,1,"Erase all strings, sure?")
If A=2 : For S=0 To STMX : ST$(S)="" : Next : Exit : End If
End If
If D=4
MN_EDIT[Rdialog(1,4)] : Exit
End If
OLDD=D
Loop
Loop
QUIT=1
End Proc
Procedure MN_EDIT[ST]
Vdialog(1,0)=ST
Vdialog$(1,1)=ST$(ST)
D=Dialog Run(1,3)
A$=Rdialog$(1,10)
If D=2 : ST$(ST)=Rdialog$(1,10) : End If
If D=3
If ST<STMX
For S=STMX-1 To ST Step -1
ST$(S+1)=ST$(S)
Next
End If
ST$(ST)=Rdialog$(1,10)
End If
If D=4
If ST<STMX
For S=ST To STMX-1
ST$(S)=ST$(S+1)
Next
End If
ST$(STMX)=""
End If
Inc BKCHANGE
End Proc
Procedure BANK_NEW
' Erase the current bank from memory
BNAME$=""
For S=0 To STMX : ST$(S)="" : Next
For P=0 To PUMX : PU$(P)="" : PUSX(P)=0 : PUSY(P)=0 : PUN(P)=0 : Next
If PNAME$<>"" : PNAME$="" : Screen Close 1 : End If
BKCHANGE=0 : BKCHUNKS=2 : SCRN=0
Erase TBNK : Erase TBNK+1
End Proc
' Graphic Element
Procedure MN_GRAPHIC
Screen 0
If PNAME$=""
MN_GLOAD
If PNAME$="" : QUIT=-1 : Pop Proc : End If
End If
CPU=0
Vdialog(1,SA)=Array(PU$(0))
Vdialog(1,SA+1)=0
D=Dialog Run(1,4)
Do
PU_ARRAY
Dialog Update 1,SA+1,,CPU,PULAST+2
Repeat
Screen 0
Multi Wait
' Flash the current element
CPU=Rdialog(1,SA+1)
If CPU>=0
If PUX(CPU)>=0
Add FL,1,0 To 10
If FL=1
_BOX[PUX(CPU),PUY(CPU),PUX(CPU)+PUSX(CPU),PUY(CPU)+PUSY(CPU)]
End If
If FL=5 : _BOX[0,0,0,0] : End If
End If
End If
D=Dialog(1) : Exit If D=1,2
If D : _BOX[0,0,0,0] : End If
On D-1 Proc MN_QUIT,MN_GLOAD,MN_GELEMENT,MN_GHLINE,MN_GBOX,MN_GDEL,MN_GCLEAR,MN_GVLINE,MN_MOVE1,MN_MOVE2,MN_INCX,MN_DECX,MN_INCY,MN_DECY,MN_MOVE
OLDD=D
Screen 1
MX=X Mouse : MY=Y Mouse
RR=16
If MX>440 and XS<(SW1-SW2)/RR-1 Then Inc XS
If MX<130 and XS>0 Then Dec XS
If MY>290 and YS<(SH1-SH2)/RR Then Inc YS
If MY<50 and YS>0 Then Dec YS
Screen Offset 1,RR*XS,RR*YS
Until QUIT
QUIT=0
Loop
_BOX[0,0,0,0]
QUIT=1
End Proc
Procedure MN_GLOAD
F$=Fsel$("**","","Please choose an IFF picture")
If F$<>""
Trap Load Iff F$,1
If Errtrap
_ERROR
Pop Proc
End If
Screen 1
SW1=Screen Width : SH1=Screen Height
'SW1=SW1-SW1 mod(16)
'Testing resolution of the image
SC=Screen Mode
If SC=$0 : SH2=256 : SW2=320 : End If
If SC=$4 : SH2=512 : SW2=320 : End If
If SC=$8000 : SH2=256 : SW2=640 : End If
If SC=$8004 : SH2=512 : SW2=640 : End If
Screen To Front 0 : Screen 0
PNAME$=F$
Inc BKCHANGE
SCRN=1 : XS=0 : YS=0
Screen Display 1,136,42,320,SH2
End If
End Proc
Procedure MN_GDEL
MN_GSELECT
If Param
If CPU<=PULAST
For P=CPU To PUMX-1
PUX(P)=PUX(P+1) : PUY(P)=PUY(P+1)
PUSX(P)=PUSX(P+1) : PUSY(P)=PUSY(P+1)
PUN(P)=PUN(P+1) : PU$(P)=PU$(P+1)
Next
PUN(PUMX)=0
Inc BKCHANGE
End If
End If
QUIT=-1
End Proc
Procedure MN_GELEMENT
MN_GGRAB[1]
End Proc
Procedure MN_GHLINE
MN_GGRAB[3]
End Proc
Procedure MN_GVLINE
MN_GGRAB[-3]
End Proc
Procedure MN_GBOX
MN_GGRAB[9]
End Proc
Procedure MN_GGRAB[T]
MN_GPIC
If Param
MN_GSELECT
If Param
Dialog Freeze
Screen Hide 0 : _GRABIT[T]
Screen Show 0 : Screen To Front 0 : Screen 0
If Param
If CPU<PUMX
If CPU<=PULAST
For P=PUMX To CPU+1 Step -1
PUX(P)=PUX(P-1) : PUY(P)=PUY(P-1)
PUSX(P)=PUSX(P-1) : PUSY(P)=PUSY(P-1)
PUN(P)=PUN(P-1) : PU$(P)=PU$(P-1)
Next
End If
End If
PUX(CPU)=BXX : PUY(CPU)=BXY
PUSX(CPU)=BXSX : PUSY(CPU)=BXSY
PUN(CPU)=T
QUIT=-1
Inc BKCHANGE
End If
Dialog Unfreeze
End If
End If
End Proc
Procedure PU_ARRAY
'* Updated Slider by M&F *
For P=0 To PUMX : PU$(P)="" : Next
PUPICS=1 : PULAST=-1
For P=0 To PUMX
If PUN(P)
A$=Str$(PUPICS) : PU$(P)=A$+Space$(4-Len(A$))
If PUN(P)=1 : A$=" - Element:" : End If
If PUN(P)=3 : A$=" - H. Line:" : End If
If PUN(P)=-3 : A$=" - V. Line:" : End If
If PUN(P)=9 : A$=" - Box :" : End If
PU$(P)=PU$(P)+A$+Str$(PUSX(P))+" x"+Str$(PUSY(P))
Add PUPICS,Abs(PUN(P))
PULAST=P
End If
Next
A$=Str$(PUPICS) : PU$(PULAST+1)=A$+Space$(4-Len(A$))+" - New Element"
Dec PUPICS
End Proc
Procedure MN_GCLEAR
D=2
If PULAST>=0
D=Dialog Box(DB$,1,"Clear all graphic elements, sure?")
End If
If D=2
NPU=0
For N=0 To PUMX
PU$(N)="" : PUN(N)=0
Next
P=-1
End If
QUIT=-1
Inc BKCHANGE
End Proc[P]
Procedure MN_GSELECT
P=-1
If CPU<0
D=Dialog Box(DB$,2,"You must select an element in the list first!")
P=0
End If
End Proc[P]
Procedure MN_GPIC
P=-1
If PNAME$=""
D=Dialog Box(DB$,2,"You must load a picture first!")
P=0
End If
End Proc[P]
Procedure _GRABIT[T]
' Prepare screen 1
Screen 1 : Clip
Gr Writing 2 : PDR=1 : O=0 : OMX=-1
Set Pattern 0 : Set Paint 0
_BOX[0,0,0,0]
' Open small info screen
Screen Open 2,640,8,2,Hires
Curs Off : Palette $55A,$FFF : Screen Display 2,,320,,
If T=1 : T$=" Grabbing a simple element" : End If
If T=3 : T$=" Grabbing an horizontal line" : End If
If T=-3 : T$=" Grabbing a vertical line" : End If
If T=9 : T$=" Grabbing a box" : End If
If T=2 : T$=" Moving an element" : End If
' Main loop
Repeat
Screen 1 : _MOUSE
MX=(MX+3) and $FFFFFFF8
If Inkey$=" " : Add BXINK,1,0 To Screen Colour : End If
' Change the position of the info screen
If MY>150
Screen Display 2,,45,,
Else
Screen Display 2,,245,,
End If
' Call the proper display routine
If MS=1
If MX<>OMX or MY<>OMY or MK<>OMK
On PDR Gosub GB1,GB2,GB3
OMX=MX : OMY=MY : OMK=MK
End If
End If
' Wait for the end
Until PDR=0 or PDR=4
' Something to erase?
_BOX[0,0,0,0]
' Close the info screen
Screen Close 2 : F=0
If PDR=4
BXX=X1 : BXY=Y1 : BXSX=SX : BXSY=SY
F=-1
End If
Repeat : _MOUSE : Until MK=0
Goto _END
' Step 1 : set the beginning of the box
GB1:
X1=MX : Y1=MY : X2=X1 : Y2=Y1
Screen 2 : Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" "
If MK=1 : PDR=2 : End If
If MK=2 : PDR=0 : End If
Return
' Step 2 : open the box
GB2:
If MX>X1 and MY>Y1
If T=1
X2=MX : Y2=MY : _BOX[X1,Y1,X2,Y2]
End If
If T=3
If MX-X1>=24
X2=X1+((MX-X1)/24)*24 : Y2=MY
_BOX[X1,Y1,X2,Y2]
End If
End If
If T=-3
If MY-Y1>=3
Y2=Y1+((MY-Y1)/3)*3 : X2=MX
_BOX[X1,Y1,X2,Y2]
End If
End If
If T=9
If MX-X1>=24 and MY-Y1>3
X2=X1+((MX-X1)/24)*24 : Y2=Y1+((MY-Y1)/3)*3
_BOX[X1,Y1,X2,Y2]
End If
End If
End If
Screen 2
Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(X2-X1)+" - SY:"+Str$(Y2-Y1)+" "
If MK=0
PDR=3 : SX=X2-X1 : SY=Y2-Y1
End If
Return
' Etape 3 : positionnement de la boite
GB3:
X2=MX : Y2=MY : X1=MX-SX : Y1=MY-SY
If X1<0 : X1=0 : X2=SX : End If
If Y1<0 : Y1=0 : Y2=SY : End If
_BOX[X1,Y1,X2,Y2]
Screen 2
Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(SX)+" - SY:"+Str$(SY)+" "
If MK=1 : PDR=4 : End If
If MK=2
PDR=1 : Cls : _BOX[0,0,0,0]
While Mouse Key : Wend
End If
Return
_END:
End Proc[F]
Procedure _BOX[X1,Y1,X2,Y2]
' Draw the box
S=Screen : Screen 1
If BXOLD : Put Block 2 : Del Block 2 : BXOLD=0 : End If
If X2>X1+1 and Y2>Y1+1
X=X1 and $FFFFFFF0
XX=Min(Screen Width,(X2+16) and $FFFFFFF0)
Gr Writing 0 : Set Pattern 2 : Set Paint 1 : Ink BXINK,BXINK,BXINK
Get Block 2,X,Y1,XX-X,Y2-Y1+1
Bar X1,Y1 To X2-1,Y2-1 : BXOLD=-1
End If
Screen S
End Proc
Procedure _MOUSE
' Mouse input
Multi Wait
MX=X Screen(X Mouse) : MY=Y Screen(Y Mouse)
MZ=Mouse Zone : MK=Mouse Key : MS=Mouse Screen
End Proc
' All the interface is here
Procedure INIT_SCREEN
Restore DBL
Repeat
Read A$ : DB$=DB$+A$
Until A$=""
ESX=660 : ESY=110 : YDI=150
Screen Open 0,ESX,ESY,8,Hires
Screen Display 0,,YDI,,
Curs Off : Flash Off : Cls 0
GRB_EDITOR_PALETTE
Paper 0 : Pen 1
Limit Mouse 128,42 To 447,297
On Error Goto ERR
Dialog Open 1,DB$,32,2048
Pop Proc
ERR: Print Mid$(DB$,Edialog,80) : Wait Key : Edit
' Definition of quick-run dialog boxes
DBL:
Data "SVar 2,'Ok';"
Data "SVar 3,'Cancel';"
Data "SIze 1VA TW 160+,64;"
Data "BAse SWidth SX -2/,SHeight SY- 2/;"
Data "IF 0VA 0\; [SAve 1;]"
Data "RBox 0,0,SX,SY,0;"
Data "CTxt 16,8,SX 16-,32,1,1VA;"
Data "IF 0VA 1=;"
Data "["
Data " BJ 1,16,SY 24-,64,16,3VA; KY 27,0;"
Data " BJ 2,SX 80-,SY 24-,64,16,2VA; KY 13,0;"
Data " RUn 0,3;"
Data "]"
Data "IF 0VA 2=;"
Data "["
Data " BJ 1,SX 80-,SY 24-,64,16,3VA; KY $FF,0;"
Data " RUn 0,3;"
Data "]"
Data "EXit;"
' Definition of the first menu page
Data "LA 1;"
Data "SVar 0,'Resource Bank Creator V"+VER$+" - Current bank : ' 0VA !;"
Data "SVar 1,'Quit';"
Data "SVar 2,'Create a new bank';"
Data "SVar 3,'Load a bank';"
Data "SVar 4,'Save Bank';"
Data "SVar 5,'Save Bank As';"
Data "SVar 6,'Edit Graphic Elements';"
Data "SVar 7,'Edit Text Strings';"
Data "SVar 8,'Grab Previous Bank';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,12,1VA;"
Data "BI 0,XB,0,SX XB-,12,0VA;"
Data "RB 0,12,SX,SY,0;"
Data "BT 3,20,20,210,15,2VA;"
Data "BT 4,XA,YB,XB XA-,YB YA-,3VA;"
Data "BT 9,XA,YB,XB XA-,YB YA-,8VA;"
Data "BT 5,XA,YB,XB XA-,YB YA-,4VA;"
Data "BT 6,XA,YB,XB XA-,YB YA-,5VA;"
Data "BT 7,250,20,XB XA-30+,19,6VA;"
Data "BT 8,XA,YB,XB XA-,YB YA-,7VA;"
Data "RB XA,60,490,95,0;"
Data "PR XA5+,65,'This program was reviewed by',3;"
Data "PR XA,YB,' M&F Software Corp.� 1994.',3;"
Data "PR XA,YB,' 9-11-1994 h17.00',3;"
Data "SVar 10,'About';"
Data "BT 10,510,20,100,55,10VA;"
Data "SVar 10,'Future Ext';"
Data "BT 11,510,76,100,19,10VA;"
Data "EXit;"
' Definition of the text menu page
Data "LA 2;"
Data "SVar 0,'AMOS Resource Bank Creator - String edition';"
Data "SVar 1,'Exit';"
Data "SVar 2,'Clear';"
Data "SVar 6,'Print';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,12,1VA;"
Data "BI 0,XB,0,SX XB-,12,0VA;"
Data "RB 0,12,SX,SY,0;"
Data "LS 3,14,22,SX78-2+,SY6-,%11;"
Data "BV 6,XB,YA,32,YB YA-,6VA;"
Data "BV 5,XB,YA,32,YB YA-,2VA;"
Data "EXit;"
' Definition of the pop-up string edition
Data "LA 3;"
Data "SVar 2,'String number ' 0VA 1+ # !;"
Data "SVar 3,'[Esc] Cancel';"
Data "SVar 4,'[Ret] Replace';"
Data "SVar 5,'[F1] Insert';"
Data "SVar 6,'[Del] Delete';"
Data "BAse 16,8; SIze SW32-,SH16-;SA 1;"
Data "RBox 0,0,SX,SY,0;"
Data "RBox 8,4,SX8-,20,1;"
Data "POut 2VA CX,8,2VA,0,3;"
Data "RBox 13,30,SX 13-,42,1;"
Data "EDit 10,16,32,72,250,1VA,0,3;"
Data "BJ 1,SX 144-,SY 24-,128,16,3VA; KY 27,0;"
Data "BJ 2,16,SY 24-,128,16,4VA; KY 13,0;"
Data "BJ 3,XB,YA,XB XA-,YB YA-,5VA; KY $D0,0;"
Data "BJ 4,XB,YA,XB XA-,YB YA-,6VA; KY $C6,0;"
Data "RU 0,3;"
Data "EXit;"
' Definition of the graphic element menu
Data "LA 4;"
Data "SVar 0,'AMOS Resource Bank Creator - Graphic Elements Edition';"
Data "SVar 1,'Exit';"
Data "SVar 2,'Change Picture';"
Data "SVar 3,'Grab Element';"
Data "SVar 4,'Grab Horiz. Line';"
Data "SVar 5,'Grab A Box';"
Data "SVar 6,'Del';"
Data "SVar 7,'Clear';"
Data "SVar 8,'Grab Vert. Line';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,12,1VA;"
Data "BI 0,XB,0,SX XB-,12,0VA;"
Data "RB 0,12,SX,SY,0;"
Data "BT 3,12,15,130,SY50-,2VA;"
Data "BT 4,XB 16+,YA, 160,11,3VA;"
Data "BT 5,XA,YB,XB XA-,YB YA-,4VA;"
Data "BT 9,XA,YB,XB XA-,YB YA-,8VA;"
Data "BT 6,XA,YB,XB XA-,YB YA-,5VA;"
Data "SVar 10,'Inc X';"
Data "BT 12,158,YB,80,YB YA-,10VA;"
Data "SVar 10,'Dec X';"
Data "BT 13,XB,YA,80,YB YA-,10VA;"
Data "SVar 10,'Inc Y';"
Data "BT 14,158,YB,80,YB YA-,10VA;"
Data "SVar 10,'Dec Y';"
Data "BT 15,XB,YA,80,YB YA-,10VA;"
Data "SVar 9,'TRANS';"
Data "BW 10,158,YB,80,YB YA-,9VA;"
Data "SVar 9,'SIZE';"
Data "BW 11,XB,YA,80,YB YA-,9VA;"
Data "SVar 9,'MOVE BLOCK';"
Data "BT 16,XB160-,YB,160,YB YA- 2+,9VA;"
Data "LS 20,XB 16+,15,SX94-,SY6-,%100;"
Data "BV 7,XB,15,25,YB14-,6VA;"
Data "BV 8,XB,15,25,YB15-,7VA;"
'Data "RB 12,76,142,107,1;"
'Data "PR 17,79,15VA,3;"
'Data "PR 17,88,16VA,3;"
Data "EXit;"
' --------------------------------
' List Slider: draw a list + a slider, linked together
' LS zone,x,y,x,y,flags
Data "UI LS,6; ["
Data "RB P2,P3,P2 16+,P5 1+,1;"
Data "RB XB,YA,P4,P51+,1;"
Data "SZone P1;"
Data "VSlide P1,P2 3+,P3 2+,9,P5 P3-1-,1P1+VA,7,256,3;[ZChange ZNum 1+,ZPos;SVar 1ZN+,ZPos;]"
Data "AList P1 1+,P2 18+,P3 2+,P4 P2- 18- 8/,P5 P3- 8/,P1 VA,1P1+VA,P6,0,3;[]"
Data "XY P2,P3,P4,P5;]"
'----------------------------------------
' One button, with vertical text, click only
' BV zone,x,y,sx,sy,text
Data "UI BV,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " VTxt SX 2/ 4- BP+,SY ZVarTLen TH* - 2/ BP+,ZV,3;]"
Data " [BR 0;]"
Data "]"
'----------------------------------------
' One button, with text, click only
' BT zone,x,y,sx,sy,text
Data "UI BT,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PR ZV CX BP+,SY TH- 2/ BP+1+,ZV,3;]"
Data " [BR 0;]"
Data "]"
'----------------------------------------
' One button, with text, remain activated
' BW zone,x,y,sx,sy,text
Data "UI BW,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PR ZV CX BP+,SY TH- 2/ BP+1+,ZV,3;]"
Data " []"
Data "]"
'----------------------------------------
' One button, with text to move the screen
' BI zone,x,y,sx,sy,text
Data "UI BI,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PR ZV CX BP+,SY TH- 2/ BP+,ZV,3;]"
Data " [SMove;BR 0;]"
Data "]"
'----------------------------------------
' One button, with text, click only, QUIT!
' BJ zone,x,y,sx,sy,text
Data "UI BJ,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PO ZV CX BP+,SY TH- 2/ BP+,ZV,0,3;]"
Data " [BR 0;BQuit;]"
Data "]"
'----------------------------------------
' Text centered in one RB
' CT x1,y1,x2,y2,act,text
Data "UI CT,6; ["
Data "RB P1,P2,P3,P4,P5;"
Data "PRint P3 P1- P6TW- 2/ P1+,P4 P2- TH- 2/ P2+,P6,3;"
Data "XY P1,P2,P3,P4;]"
'----------------------------------------
' Ronnies Simpson graphic box definition
' RB x1,y1,x2,y2,activated
Data "UI RB,5; [SWrite 1; SPattern 0,0;"
Data "IF P5 0=;["
Data "INk 0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
Data "INk 6,6,6; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
Data "INk 5,5,5; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
Data " GLine P1 1+,P4 2-,P1 1+,P2 1+;"
Data " GLine P1 1+,P2 1+,P3 2-,P2 1+;"
Data "INk 2,2,2; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
Data " GLine P3 3-,P2 2+,P3 3-,P4 2-;"
Data " GLine P3 2-,P2 1+,P3 2-,P4 2-;"
Data "INk 3,3,3; GLine P1 3+,P2 2+,P1 4+,P2 2+;]"
Data "IF P5 0\;["
Data "INk 0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
Data "INk 2,2,2; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
Data "INk 1,1,1; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
Data " GLine P1 1+,P4 2-,P1 1+,P2 1+;"
Data " GLine P1 1+,P2 1+,P3 2-,P2 1+;"
Data "INk 5,5,5; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
Data " GLine P3 3-,P2 2+,P3 3-,P4 2-;"
Data " GLine P3 2-,P2 1+,P3 2-,P4 2-;]"
Data "SWrite 0; XY P1,P2,P3,P4;]"
Data ""
End Proc
Procedure GRB_EDITOR_PALETTE
ADAT=Leek(Dreg(3))
If ADAT=0
Palette 0,$6F,$77,$EEE,$F00,$DD,$AA,$FF3
Else
For C=0 To 7
Colour C,Deek(ADAT+28+C*2)
Next
Colour 1,(Colour(2) and $EEE)/2
End If
End Proc
Procedure LOWMEM
Screen Open 0,640,8,2,Hires : Curs Off
Colour 1,$FFF
Centre "Memory too low. Press any key to abort."
Wait Key
Edit
End Proc
Procedure MN_PRINT
Dialog Freeze
For MS=STMX To 0 Step -1
Exit If ST$(MS)-" "<>""
Next
If MS>=0
X=Free
D=Dialog Box(DB$,1,"Print all strings: please check printer and click on [OK]") : If D<>2 : Pop Proc : End If
Do
Trap Printer Open
Exit If Errtrap=0
R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
If R<>2 : Pop Proc : End If
Loop
D=Dialog Box(DB$,0,"Printing resource strings.")
For S=0 To MS
If Printer Online=0
Repeat
R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
Exit If R<>2,2
Until Printer Online
End If
A$=Mid$(Str$(S),2)+"-"+ST$(S)
Trap Printer Send A$+Chr$(27)+"E"
Repeat : Exit If Inkey$<>"",2 : Multi Wait : Until Printer Check
Next
Repeat : Exit If Inkey$<>"" : Until Printer Check
Trap Printer Close
End If
Dialog Unfreeze
Pop Proc
End Proc
Procedure MN_MOVE
Dialog Freeze
Screen Hide 0
T=1 : X2=PUSX(CPU) : Y2=PUSY(CPU)
SX=X2 : SY=Y2
XF1=PUX(CPU) : YF1=PUY(CPU)
' Prepare screen 1
Screen 1 : Clip
Gr Writing 2 : PDR=1 : O=0 : OMX=-1
Set Pattern 0 : Set Paint 0
_BOX[0,0,0,0]
' Open small info screen
Screen Open 2,640,8,2,Hires
Curs Off : Palette $55A,$FFF : Screen Display 2,,320,,
T$=" Moving an element"
' Main loop
Repeat
Screen 1 : _MOUSE
MX=(MX+3) and $FFFFFFF8
If Inkey$=" " : Add BXINK,1,0 To Screen Colour : End If
' Change the position of the info screen
If MY>150
Screen Display 2,,45,,
Else
Screen Display 2,,245,,
End If
' Call the proper display routine
If MS=1
If MX<>OMX or MY<>OMY or MK<>OMK
On PDR Gosub GB1
OMX=MX : OMY=MY : OMK=MK
End If
End If
' Wait for the end
Until PDR=0 or PDR=4
' Something to erase?
_BOX[0,0,0,0]
' Close the info screen
Screen Close 2 : F=0
If PDR=4
BXX=X1 : BXY=Y1 : BXSX=SX : BXSY=SY
F=-1
Goto _END
End If
Goto _END1
' Step 1 : set the beginning of the box
GB1:
X1=MX : Y1=MY : X2=SX : Y2=SY
If MX<SX : MX=SX : X Mouse=X Hard(MX) : End If
If MY<SY : MY=SY : Y Mouse=Y Hard(MY) : End If
Screen 2 : Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" - W:"+Str$(SX)+" - H:"+Str$(SY)+" "
X2=MX : Y2=MY : X1=MX-SX : Y1=MY-SY
_BOX[X1,Y1,X2,Y2]
If MK=1 : PDR=4 : End If
If MK=2 : PDR=0 : PUX(CPU)=XF1 : PUY(CPU)=YF1 : End If
Return
_END:
PUX(CPU)=X1 : PUY(CPU)=Y1
_END1:
Screen Show 0 : Screen To Front 0 : Screen 0
Dialog Unfreeze
End Proc[F]
Procedure MN_INCX
Screen 1 : SW=Screen Width
If PUN(CPU)=1 : XVA=8 : YVA=1 : End If
If PUN(CPU)=3 : XVA=24 : YVA=1 : End If
If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If
If PUN(CPU)=9 : XVA=24 : YVA=3 : End If
If MOVE=2
If PUX(CPU)+PUSX(CPU)<SW-XVA
Add PUSX(CPU),XVA
End If
End If
If MOVE=1
If PUX(CPU)<SW
Add PUX(CPU),8
End If
End If
PU_ARRAY1
Dialog Update 1,SA+1,,CPU,PULAST+2
End Proc
Procedure MN_DECX
If PUN(CPU)=1 : XVA=8 : YVA=1 : End If
If PUN(CPU)=3 : XVA=24 : YVA=1 : End If
If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If
If PUN(CPU)=9 : XVA=24 : YVA=3 : End If
If MOVE=2
If PUSX(CPU)>XVA+1
Add PUSX(CPU),-XVA
End If
End If
If MOVE=1
If PUX(CPU)>7
Add PUX(CPU),-8
End If
End If
PU_ARRAY1
Dialog Update 1,SA+1,,CPU,PULAST+2
End Proc
Procedure MN_INCY
Screen 1 : SH=Screen Height
If PUN(CPU)=1 : XVA=8 : YVA=1 : End If
If PUN(CPU)=3 : XVA=24 : YVA=1 : End If
If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If
If PUN(CPU)=9 : XVA=24 : YVA=3 : End If
If MOVE=2
If PUY(CPU)+PUSY(CPU)<SH-1
Add PUSY(CPU),YVA
PU_ARRAY1
Dialog Update 1,SA+1,,CPU,PULAST+2
End If
End If
If MOVE=1
If PUY(CPU)<SH
Add PUY(CPU),1
End If
End If
End Proc
Procedure MN_DECY
If PUN(CPU)=1 : XVA=8 : YVA=1 : End If
If PUN(CPU)=3 : XVA=24 : YVA=1 : End If
If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If
If PUN(CPU)=9 : XVA=24 : YVA=3 : End If
If MOVE=2
If PUSY(CPU)>YVA+1
Add PUSY(CPU),-YVA
End If
End If
If MOVE=1
If PUY(CPU)>0
Add PUY(CPU),-1
End If
End If
PU_ARRAY1
Dialog Update 1,SA+1,,CPU,PULAST+2
End Proc
Procedure PU_ARRAY1
'aggiorna la lista velocemente
PUPICS=CPU+1
P=CPU
If PUN(CPU)
A$=Str$(PUPICS) : PU$(P)=A$+Space$(4-Len(A$))
If PUN(P)=1 : A$=" - Element:" : End If
If PUN(P)=3 : A$=" - H. Line:" : End If
If PUN(P)=-3 : A$=" - V. Line:" : End If
If PUN(P)=9 : A$=" - Box :" : End If
PU$(P)=PU$(P)+A$+Str$(PUSX(P))+" x"+Str$(PUSY(P))
Add PUPICS,Abs(PUN(P))
End If
Screen 0
End Proc
Procedure MN_MOVE1
MOVE=1
Dialog Update 1,11,0
End Proc
Procedure MN_MOVE2
MOVE=2
Dialog Update 1,10,0
End Proc
Procedure _ERROR
D=Dialog Box(DB$,2,"It is not an IFF picture!")
End Proc
' Not yet implemented
Procedure _INFO
SH$=Str$(SH1) : SW$=Str$(SW1)
L=Len(SW$)+Len(SH$)
L$=Space$((13-L)/2)
S$="W"+SW$+L$+"H"+SH$+" "
Vdialog$(1,15)=S$
If SW2=320 Then S$="Lowres" Else S$="Hires"
If SH2=256 Then S1$="No-Lace" Else S1$="Laced"
S$=" "+S$+" "+S1$
Vdialog$(1,16)=S$
End Proc